package mtest2.day2;

public class Demo3 {
    public static void main(String[] args) {
        Animal animal = new Animal("小黄狗", 9);
        Dog dog = new Dog("小七", 3);
        dog.drink();
        animal.drink();
        System.out.println("________________________");
        System.out.println(animal.age);
        System.out.println(animal.name);
        System.out.println(dog.age);
        System.out.println(dog.name);
        System.out.println("++++++++++++++++++++");
        //多态
        animalDrink(animal);
        animalDrink(dog);
    }

    public static void animalDrink(Animal animal) {
        animal.drink();
    }

}

